public class test {
}
class Solution {
    public int maxPower(String s) {
        int i=0, ans=1;
        while(i<s.length()){
            int j = i;
            i++;
            while(i<s.length() && s.charAt(j) == s.charAt(i)){
                i++;
            }
            ans = Math.max(ans,i-j);
        }
        return ans;
    }
}
class Solution1 {
    public boolean checkZeroOnes(String s) {
        int i=0, zero=0, one=0;
        int n = s.length();
        while(i<n){
            int start = i;
            while(i<n && s.charAt(i)=='0'){
                i++;
            }
            zero = Math.max(zero,i-start);
            start = i;
            while(i<n && s.charAt(i)=='1'){
                i++;
            }
            one = Math.max(one, i-start);
        }
        return zero < one;
    }
}

class Solution2 {
    public String makeFancyString(String s) {
        int i=0, n=s.length();
        StringBuilder res = new StringBuilder();
        while(i<n){
            res.append(s.charAt(i));
            int j=i;
            i++;
            while(i<n && s.charAt(i-1)==s.charAt(i)){
                i++;
                if(i-j<=2) res.append(s.charAt(i-1));
            }
        }
        return res.toString();
    }
}